package com.whcoding.designpatterns.pattern.factorypattern.abstractfactory;

/**
 * @program: spring-boot-learning
 * @description:
 * @author: whcoding
 * @create: 2022-09-19 17:34
 **/
public class ConsumerTests {

	/**
	 *
	 * 操作步骤说明
	 * 1.创建一个超级工厂类 IProductFactory 里面包含手机和路由器  IPhoneProduct  IRouterProduct 接口
	 *
	 * 2.创建接口 IPhoneProduct  里面方法包含 callUp， sendMessage
	 * 		     IRouterProduct  里面方法包含 openWifi，openRouter
	 *
	 *
	 * 3.添加 IPhoneProduct 、IRouterProduct 的实现类 IPhoneProductImpl、IRouterProductImpl
	 *
	 * 4.添加 IProductFactory 的实现类  XiaomiFactoryImpl 、HuaweiFactoryImpl 实现类中实现接口
	 *
	 *
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("------------小米产品---------------");
		XiaomiFactoryImpl xiaomiFactory = new XiaomiFactoryImpl();      //小米工厂
		IPhoneProduct xiaomiPhone = xiaomiFactory.phoneProduct();   //生产小米手机
		xiaomiPhone.callUp();
		xiaomiPhone.sendMessage();

		IRouterProduct xiaomiRouter = xiaomiFactory.routerProduct();//生产小米路由器
		xiaomiRouter.openRouter();
		xiaomiRouter.openWifi();

		System.out.println("------------华为产品---------------");
		HuaweiFactoryImpl huaweiFactory = new HuaweiFactoryImpl();      //华为工厂
		IPhoneProduct huaweiPhone = huaweiFactory.phoneProduct();   //华为手机
		huaweiPhone.callUp();
		huaweiPhone.sendMessage();
		IRouterProduct huaweiRouter = huaweiFactory.routerProduct();//华为路由器
		huaweiRouter.openRouter();
		huaweiRouter.openWifi();


	}
}
